home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / tools / install / pinstall / str_dir.pow < prev    next >
Encoding:
Text File  |  1994-06-05  |  4.5 KB  |  110 lines

  1. rem **************************************************************************
  2. rem *                                                                        *
  3. rem * This script reads a directory from the operator, verifies it and       *
  4. rem * returns a message. It demonstrates GOSUB, window operations,           *
  5. rem * READ_STRING, VERIFY_PATH, IF and GOTO.                                 *
  6. rem *                                                                        *
  7. rem * Compile by running PINST.EXE                                           *
  8. rem *                                                                        *
  9. rem **************************************************************************
  10.  
  11. rem **************************************************************************
  12. rem *                                                                        *
  13. rem *                           Declare variables                            *
  14. rem *                                                                        *
  15. rem **************************************************************************
  16.  
  17. intvar  key
  18. intvar  destwin
  19. intvar  errwin
  20. intvar  tmp
  21. strvar  destdir
  22. strvar  errstr
  23.  
  24. rem **************************************************************************
  25. rem *                                                                        *
  26. rem *                             Define windows                             *
  27. rem *                                                                        *
  28. rem **************************************************************************
  29.  
  30. errwin = define_win 62 5 9 10 2 yes ' ' white red ltwhite black
  31. win_puts   errwin 1 4 "[ Hit any key ]"
  32.  
  33. destwin = define_win 54 5 13 7 1 yes ' ' white blue ltbrown blue
  34. win_puts destwin 2 2 "Directory: "
  35.  
  36. destdir = "C:\PINST"                                        Initial directory
  37.  
  38. show_win destwin                                        Show read dest window
  39.  
  40. rem ********************** Get pathname ***********************************
  41.  
  42. label read_dest
  43.  
  44. tmp = read_string destwin 13 2 38 ltwhite black yes destdir     Read path
  45. if tmp == 0 goto done_install                                   Aborted ?
  46.  
  47. rem ********************** Verify path ************************************
  48.  
  49. key = verify_path destdir                                       Verify path
  50.  
  51. rem ********************** Critical error *********************************
  52.  
  53. if key <> 4 goto not_crit                               Critical ?
  54. errstr = "                        Critical error"
  55. gosub show_error                                        Show error
  56. goto  read_dest
  57.  
  58. rem ********************** Is path a file ? *******************************
  59.  
  60. label not_crit
  61. if key <> 3 goto notfile                                Is a file ?
  62. errstr = "                        That is a file"
  63. gosub show_error                                        Show error
  64. goto  read_dest
  65.  
  66. rem ************************** Bad disk ***********************************
  67.  
  68. label notfile
  69. if key <> 2 goto not_disk                               Bad disk ?
  70. errstr = "                         Bad directory"
  71. gosub show_error                                        Show error
  72. goto  read_dest
  73.  
  74. rem *************************** Bad dir ***********************************
  75.  
  76. label not_disk
  77. if key <> 1 goto good_dir                                Bad dir ?
  78. errstr = "                           Bad disk"
  79. gosub show_error                                         Show error
  80. goto  read_dest
  81.  
  82. rem *************************** Good dir **********************************
  83.  
  84. label good_dir                                           End of installation
  85. errstr = "                         Good directory"
  86. gosub show_error                                         Show error
  87.  
  88. goto done_install
  89.  
  90. rem **************************************************************************
  91. rem *                                                                        *
  92. rem *                           Show error window                            *
  93. rem *                                                                        *
  94. rem **************************************************************************
  95.  
  96. label show_error
  97. win_puts errwin 1 2 "                                                            "
  98. win_puts errwin 1 2 errstr
  99. show_win errwin
  100. leftmouse
  101. hide_win errwin
  102. return
  103.  
  104. rem ***************************** Exit **********************************
  105.  
  106. label done_install
  107. hide_win destwin
  108. exit 0                                                   Exit
  109.  
  110.